#ifndef ___THREAD_POOL__
#define ___THREAD_POOL__
#include <func.h>
#include "taskQueue.h"
#include "link_list.h"
#include "utils.h"
// 主线程维持每一个子线程的信息
typedef struct threadPool_s {
    //子线程的数据
    pthread_t *tidArr;
    int workerNum;
    //任务队列
    queue_t taskQueue;
    //锁
    pthread_mutex_t mutex;
    // 条件变量
    pthread_cond_t cond;
    int exitflag;
} threadPool_t;

typedef struct train_s {
    int length;
    char data[1000];
} train_t;

//ls 命令传组包用
typedef struct train_ls_s {
    int length;
    char data[4096];
} train_ls_t;

int makeWorker(threadPool_t *pthreadPool);
void *threadFunc(void * arg);
int tcpInit(int *psockfd, const char *ip, const char *port);
int epollAdd(int epfd, int fd);
int epollDel(int epfd, int fd);
//int transFile(int netfd,char*);
int transFile(int netfd, char *path,char* fileNameToUser);
int recvFile(int netfd,char *commandPath1);
int md5(int fd,char* filepath);
int commandDivid(char* str,char* commandSave,char* commandPath1,char* commandPath2);
int commandSelect(char *command, char *path,char *path_cli,char* root,int netfd,char* fileNameToUser,link_list* path_now_list);
void cd_function(char*commandPath1,char*finalpath,char*root,char* next_startpath,link_list* path_now_list);
int recvn(int sockfd,void *buf, int length);
int remove_my(char *path,int netfd);
#endif